//import java.util.Timer;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class VideoPlayer {

	private static int vid_framerate_fps = 24;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
	    if (args.length < 2) {
	        System.err.println( "Usage: java VideoPlayer RGBFile WavFile" );
	        System.exit( 1 );
	    }
	    
	    PlayVideoFrameTask playVideoFrameTaskObj = new PlayVideoFrameTask(args[0], vid_framerate_fps);
	    PlayAudioThread playAudioThreadObj = new PlayAudioThread(args[1], vid_framerate_fps);
	    
	    playAudioThreadObj.start();
	    
	    //Thread.sleep(1000); //Constant offset for this sample?!
	    
	    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(3);
	    executor.scheduleAtFixedRate(playVideoFrameTaskObj, 0L, 1000000000/vid_framerate_fps, TimeUnit.NANOSECONDS);

	    
	}
}
